#ifndef MAINWIN
#define MAINWIN

#include <QWidget>
#include <QDebug>
#include <QObject>
#include <QPushButton>
#include <QComboBox>
#include <QLineEdit>
#include <QLabel>
#include <QRadioButton>
#include <QCheckBox>
#include "device/ioctrl.h"

class MainWin : public QWidget
{
    Q_OBJECT
public:
    MainWin(QWidget *parent = 0);
public slots:
    void slotErrMsg(const QString& strErr);
private:
    void createWin();
    void setConnect();
    void returnBitNum();
    void returnGroupNum();
private slots:
    void slotOpenCom();
    void slotBitOpenBtn();
    void slotBitCloseBtn();
    void slotGroupOpenBtn();
    void slotGroupCloseBtn();
    void slotAllOpenBtn();
    void slotAllCloseBtn();
private:
    QPushButton  *m_pBitOpenBtn;
    QPushButton  *m_pBitCloseBtn;
    QRadioButton *m_pBitBarrier0Radio;
    QRadioButton *m_pBitBarrier1Radio;
    QRadioButton *m_pBitBarrier2Radio;
    QRadioButton *m_pBitBarrier3Radio;

    QPushButton  *m_pGroupOpenBtn;
    QPushButton  *m_pGroupCloseBtn;
    QCheckBox    *m_pGroupBarrier0Radio;
    QCheckBox    *m_pGroupBarrier1Radio;
    QCheckBox    *m_pGroupBarrier2Radio;
    QCheckBox    *m_pGroupBarrier3Radio;

    QPushButton  *m_pAllOpenBtn;
    QPushButton  *m_pAllCloseBtn;

    QLabel       *m_pResultLbl;
    IoCtrl       *m_ioCtrl;
    QLineEdit    *m_pComEdit;
    QPushButton  *m_pOpenCom;

    quint8 bitHandle;
    quint8 groupHandle;
    bool   bOpen;
};


#endif // MAINWIN

